package com.xing.web;

import com.xing.config.boot.GracefulExitConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.context.support.ApplicationObjectSupport;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by Bradish7Y on 2017/8/21.
 */
@RestController
public class GracefulExitApplicationController extends ApplicationObjectSupport {

    @Autowired
    private GracefulExitConfig gracefulExitConfig;

    @GetMapping("/exit")
    public String exit() {
        SpringApplication.exit(super.getApplicationContext(), gracefulExitConfig);

        //走不到return
        return "succeed to exit";
    }
}
